package away3d.animators.data ;


import away3d.events.AnimatorEvent ;
import away3d.library.assets.AssetType ;
import away3d.library.assets.IAsset ;
import away3d.library.assets.NamedAssetBase ;
import flash.geom.Vector3D ;



/**
 * The AnimationSequenceBase provides an abstract base class for pre-animated animation clips.
 *
 * todo: support frame bounds
 */
class AnimationSequenceBase extends NamedAssetBase implements IAsset
{
    
    //TODO: OOPs I took out some setter getters that I sould probably add back till we are sure to remove.
    
    /**
     * Indicates whether or not the animation sequence loops.
     */
    public var looping                  : Bool;
    public var rootDelta                : Vector3D<Float>;// TODO: Do we need to type this?
    public var totalDuration            : Int ; //UInt
    public var _fixedFrameRate          : Bool;
    public var _durations               : Vector<Int> ;//Uint?
    private var _animationEvent         : AnimatorEvent ;
    
    
    
    /**
     * Creates a new AnimationSequenceBase object.
     * @param name The name of the animation clip. It will be used as the identifier by sequence controller classes.
     */
    public function new( name: String )
    {
        
        super( name ) ;
        _fixedFrameRate     = true ;
        looping             = true ;
        _durations          = new Vector() ;
        rootDelta           = new Vector3D() ;
        _animationEvent     = new AnimatorEvent( AnimatorEvent.SEQUENCE_DONE, null, this ) ;
        
    }
    
    
    public function getAssetType() : String
    {
        
        return AssetType.ANIMATION ;
        
    }
    
    
    public var fixedFrameRate( get_fixedFrameRate, set_fixedFrameRate ): Bool
    
    
    /**
     * Indicates whether the frames have a uniform duration, 
     * or whether frames are spread out unevenly over the timeline. Defaults to true.
     */
    public function get_fixedFrameRate() : Bool
    {
        
        return _fixedFrameRate ;
        
    }
    
    
    public function set_fixedFrameRate( value : Bool ) : Bool
    {
        
        _fixedFrameRate = value ;
        return value ;
        
    }
    
    
    /**
     * Cleans up any resources used by the current object.
     * @param deep Indicates whether other resources should be cleaned up, 
     *  that could potentially be shared across different instances.
     */
    public function dispose( deep : Bool )
    {
        
        
        
    }
    
    
    public function notifyPlaybackComplete()
    {
        
        dispatchEvent( _animationEvent );
        
    }
    
    
}